* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

li {
    list-style: none;
}

.accordion {
    width: 300px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
}

.accordion > li {
    width: 100%;
}

.accordion > li input {
    display: none;
}

.accordion > li label {
    position: relative;
    display: block;
    width: 100%;
    background-color: #5fb878;
    padding: 20px 50px;
    color: #fff;
    cursor: pointer;
}

.accordion > li label i {
    position: absolute;
    top: calc(50% - 12px);
    left: 20px;
    font-size: 24px;
    /* 设置过渡 */
    transition: all .5s;
}

/* 实现三角形的第一种方式 */
/*
.accordion > li label::after {
    content: '';
    position: absolute;
    right: 20px;
    bottom: -14px;
    width: 30px;
    height: 15px;
    background-color: inherit;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}
*/

/* 实现三角形的第二种方式 */
.accordion > li label::after {
    content: "";
    position: absolute;
    right: 25px;
    bottom: -10px;
    width: 20px;
    height: 20px;
    background-color: inherit;
    transform: rotate(45deg);
}

.accordion > li label:hover {
    background-color: #53aa6c;
}

/* :not() 选择器选取的是除括号里的元素以外的其它元素 */
.accordion>li:not(:first-child) label {
    border-top: 1px solid #38814d;
}

.accordion > li ol {
    width: 100%;
    background-color: #333;
}

.accordion > li ol li {
    position: relative;
    width: 100%;
    height: 0;
    color: #fff;
    line-height: 50px;
    padding-left: 20px;
    cursor: pointer;
    /* 设置过渡 */
    transition: all .5s;
}

.accordion > li ol li::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 0;
    width: 5px;
    height: 44px;
    background-color: #5fb878;
    transform: scaleY(0);
    /* 设置过渡 */
    transition: all .5s;
    /*transform-origin: 50% 0;*/
}

.accordion > li ol li:hover::before {
    transform: scaleY(1);
}

.accordion > li input:checked ~ label i {
    transform: rotate(90deg);
}

.accordion > li input:checked ~ ol li {
    height: 50px;
}
